package com.example.demo.util;/**
 * 类描述
 *
 * @author 8522
 * @date 2021/10/8 16:30
 * 版权所有 Copyright www.dahantc.com
 */

import java.util.concurrent.ScheduledFuture;

/**
 *@Description:
 *@Author: 8522
 *@Date: 2021/10/8  16:30
 *@Version v1.0
 */
public final class ScheduledTask {

    volatile ScheduledFuture<?> future;

    /**
     * 取消定时任务
     */
    public void cancel() {
        ScheduledFuture<?> future = this.future;
        if (future != null) {
            future.cancel(true);
        }
    }
}
